// 小程序api promise封装


const wx_login = () => {
    return new Promise ((resolve,reject) => {
        wx.login({
            success: function(res) {
                if(res.code) {
                    resolve(res)
                } else {
                    console.log(res.errMsg)
                    reject(res)
                }
            },
            fail: reject
        })
    })
}

const wx_getSetting = () => {
    return new Promise ((resolve,reject)=> {
        wx.getSetting({
            success: resolve,
            fail: reject ,
        }); 
    })
}

const wx_openSetting = () => {
    return new Promise((resolve,reject) => {
        wx.openSetting({
            success: resolve,
            fail: reject,
        });
    })
}
module.exports = {
    wx_login,
    wx_getSetting,
    wx_openSetting
}
